<?
layout("/inc/layout.html",{title:sysTitle}){
?>
<div id="page-wrapper">
	<!--BEGIN TITLE & BREADCRUMB PAGE-->
	<div id="title-breadcrumb-option-demo" class="page-title-breadcrumb">
		<div class="page-header pull-left">
			<div class="page-title">词发现</div>
		</div>
		<ol class="breadcrumb page-breadcrumb pull-left">
			<li><i class="fa fa-home"></i>&nbsp;<a href="main.html">首页</a>&nbsp;&nbsp;<i
				class="fa fa-angle-right"></i>&nbsp;&nbsp;</li>
			<li>词发现&nbsp;&nbsp;<i class="fa fa-angle-right"></i>&nbsp;&nbsp;</li>
			<li class="active">在线演示</li>
		</ol>
		<div class="clearfix"></div>
	</div>
	<!--END TITLE & BREADCRUMB PAGE-->
	<!--BEGIN CONTENT-->
	<div class="page-content">
		
<!-- 		<img src="images/slide2.png" width="70%" height="100px;"/> -->
		
		<div class="row" style="margin-top: 10px;">
			<div class="col-lg-12" style="margin-top: 10px;">
				<div class="form-group">
					<div class="col-md-2" style="text-align:center"> 
						<label for="inputPhone" class="control-label">最大分词长度:</label>
					</div>
					<div class="col-md-9">
						<input id="maxLen" type="text" class="form-control"  name="maxLen" value="10" />
					</div>
				</div>
			</div>
			<br/>
			<div class="col-lg-12" style="margin-top: 10px;">
				<div class="form-group">
					<div class="col-md-2" style="text-align:center">
						<label for="inputPhone" class="control-label">最小词频:</label>
					</div>
					<div class="col-md-9">
						<input id="minCiPin" type="text" class="form-control"  name="minCiPin" value="2" />
					</div>
				</div>
			</div>
			<br/>
			<div class="col-lg-12" style="margin-top: 10px;">
				<div class="form-group">
					<div class="col-md-2" style="text-align:center">
						<label for="inputPhone" class="control-label">最小自由度:</label>
					</div>
					<div class="col-md-9">
						<input id="minZyd" type="text" class="form-control"  name="minZyd" value="0.6" />
					</div>
				</div>
			</div>
			<br/>
			<div class="col-lg-12" style="margin-top: 10px;">
				<div class="form-group">
					<div class="col-md-2" style="text-align:center">
						<label for="inputPhone" class="control-label">最小凝固度:</label>
					</div>
					<div class="col-md-9">
						<input id="minNgd" type="text" class="form-control"  name=""minNgd"" value="200" />
					</div>
				</div>
			</div>
			<div class="col-lg-12" style="margin-top: 10px;">
				<div class="form-group">
					<div class="col-md-2" style="text-align:center">
						<label for="inputPhone" class="control-label">样例数据:</label>
					</div>
					<div class="col-md-9">
						<textarea id="text" name="text" rows="10" class="form-control"></textarea>
					</div>
				</div>
			</div>
			<div class="col-lg-12" style="margin-top: 10px;">
				<a href="#" onclick="submitForm();" class="btn btn-success pull-right">提交文本<i class="fa fa-rocket"></i></a>
			</div>
		</div>
		
		<div class="row">
			<div class="col-lg-12">
				<ul id="generalTab" class="nav nav-tabs ul-edit responsive">
					<li class="active"><a href="#dp-7">提取结果</a></li>
				</ul>
				<div  class="tab-content responsive">
					
					<!-- 语义联想 -->
					<div id="dp-7" class="tab-pane fade in active">
						<div class="row" id="words">
							<p>&nbsp;&nbsp; 数据为空！</p> 
						</div>
					</div>
					
					
				</div>
			</div>
		</div>
		
		

	</div>
	<!--END CONTENT-->
</div>

<link type="text/css" rel="stylesheet" href="static/dependency.css">

<script type="text/javascript" src="static/d3.min.js"></script>
<script type="text/javascript" src="static/lex.js"></script>
<script type="text/javascript" src="static/dependency.js"></script>

<SCRIPT type="text/javascript">

function submitForm() {
	var maxLen = $("#maxLen").val();
	var ciPin = $("#minCiPin").val();
	var zyd = $("#minZyd").val();
	var ngd = $("#minNgd").val();
	var text = $("#text").val();
	if($.trim(maxLen).length<1 && $.trim(ciPin).length<1 && $.trim(zyd).length<1 && $.trim(ngd).length<1
		&& $.trim(text).length<1) {
		alert("请输入相关参数");
		return false;
	}
	doBuildWords(maxLen,ciPin,zyd,ngd,text);
	
}

//提取词
function doBuildWords(maxLen,ciPin,zyd,ngd,text) {
	$.ajax({
		type: "post",
		url: "doBuildWords",
		data: {
			"text": text,
			"maxLen": maxLen,
			"minCiPin":ciPin,
			"minZyd":zyd,
			"minNgd":ngd
			
		},
		dataType: "json",
		success: function(data) {
			var html = ""; // 追加內容
			if(data.msg == "success"){
				var html ='<div class="col-lg-12">'							
						+'<table class="table table-hover table-striped table-bordered table-advanced tablesorter mbn">'
						+'<thead>'
						+'<tr>'                 
						+'<th>词</th><th>词频</th><th>凝固度</th><th>自由度</th>'
						+'</tr>'
						+'</thead>'
						+'<tbody>';
			  	 $(data.data).each(function(i,v) {
			  		html+='<tr><td>'+ v.word +'</td><td>'+ v.cipin +'</td><td>'+v.ngd+'</td><td>'+v.zyd+'</td></tr>';
			  	 });
			  	 html += '</tbody></table></div>';
			  	 $("#words").html(html);
			}else{
				 $("#words").html("获取结果失败");
			}
			
		},
		error : function(data) {
			// alert("请求失败");
		}
	});
}
</SCRIPT>


<?} ?>

